/*
 * @Date: 2021-08-15 12:06:06
 * @information: 全局返回格式
 */
const s = (data = null) => ({
  code: 1000,
  message: 'ok',
  result: data,
})
const f = (data = '未知错误', code = 500) => ({
  code,
  message: data,
  result: null,
})

const globalRes = {
  successRes: function (data) {
    return s(data)
  },

  failRes: function (data, code) {
    return f(data, code)
  }
}

module.exports = globalRes

